<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>求出1-100的素数</title>
</head>
<body>
<div>
    <p>100以内的素数有:</p>
</div>
<script type="text/javascript">
    for (let i = 2; i < 100; i++) {
        var flag = true;
        for (let j = 2; j < i; j++) {
            /*判断i能否被j整除*/
            if (i % j == 0) {
                /*若i能被j整除贼 i不是素数*/
                flag = false;
            }
        }
        /*打印素数*/
        if (flag == true) {
            document.write(i + '&nbsp;')
        }
    }
</script>
</body>
</html>